package cn.edu.htu.controller;



import cn.edu.htu.entity.Account;
import cn.edu.htu.service.IAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author dakai
 * @since 2021-06-05
 */
@RestController
@RequestMapping("/account")
public class AccountController {


    @Autowired
    private IAccountService iAccountService;

    /**
     * 查询所有用户及其账户金额
     */
    @RequestMapping(value = "/list",method = RequestMethod.GET)
    public Map<String,Object> accountList(){
        Map<String,Object> modelMap = new HashMap<>();
        List<Account> accounts = iAccountService.selectAccountUserList();
        modelMap.put("accounts",accounts);
        return modelMap;
    }
}
